package MULE.Model.Panel;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import MULE.Model.Logic.MenuLogic;

import java.awt.Font;

/**
 * Panel that holds game icon and menu button.
 * 
 * @author jstep
 */
public class MenuButtonPanel extends JPanel {

	public static final int PANEL_WIDTH = 90;

	private JButton menuButton;

	/**
	 * Creates and assembles the components of the menu panel. Panel components
	 * are not given action listeners in the constructor.
	 */
	public MenuButtonPanel() {
		// Initialize panel.
		Dimension panelDim = new Dimension(PANEL_WIDTH,
				FooterPanel.PANEL_HEIGHT);
		this.setPreferredSize(panelDim);
		this.setBackground(Color.WHITE);
		setLayout(null);
		// Add Mule icon and menu button.
		JLabel label = new JLabel("MULE");
		label.setFont(new Font("Lucida Grande", Font.PLAIN, 21));
		label.setBounds(18, 6, 66, 47);
		add(label);
		menuButton = new JButton("Menu");
		menuButton.setActionCommand(MenuLogic.ActionCommand.ENTER_MENU
				.toString());
		menuButton.setBounds(6, 65, 78, 29);
		menuButton.setFocusable(false);
		add(menuButton);
	}

	/**
	 * Adds an action listener to the panel's menu button.
	 * 
	 * @param listener
	 *            The menu button's action listener.
	 */
	public void addMenuButtonListener(ActionListener listener) {
		menuButton.addActionListener(listener);
	}
}
